/*
 * Copyright (C) 2012 Wojciech Dzierżanowski
 * See LICENSE.txt for licensing details.
 */

package wdzierzan.downstream.core;

class PathUtils {
    /**
     * Formats a path string for use in a shell command.
     *
     * The path string is potentially altered to make sure it can be used in a
     * shell command without causing wildcard expansion or other side effects.
     *
     * @param path the original path string
     * @return <code>path</code> transformed to something that can be safely
     *      used in a shell command
     */
    public static String escape(String path) {
        return "'" + path.replace("'", "'\\''") + "'";
    }
}
